package com.gxa.controller;

import com.gxa.pojo.StoreSetup;
import com.gxa.utils.Constants;
import com.gxa.utils.ResponseData;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 * User: tx
 * Date: 2020/11/26 16:29
 * Description:
 * Version: V1.0
 */
@RestController
@Api(value = "门店列表设置",tags = "门店列表设置")
@RequestMapping(value = "options")
public class StoresController {

    @Autowired
    private ResponseData responseData;
    @Autowired(required = false)
    private Constants constants;

    @PostMapping("/addStoresOptions")
    @ApiOperation(value = "添加支付方式",notes = "根据提交的信息添加支付方式",httpMethod = "POST",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "添加成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "添加失败")
    })
    public ResponseData addStoresOptions(@RequestBody @ApiParam(name = "storeSetup",value = "门店列表",required = true) StoreSetup storeSetup){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("添加成功");
        responseData.setData(storeSetup);
        return responseData;
    }



    @GetMapping("/delStoresOptions")
    @ApiOperation(value = "删除门店列表",notes = "根据提交的信息删除门店列表",httpMethod = "GET",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "操作成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "操作失败")
    })
    public ResponseData delStoresOptions(@ApiParam(name = "pmsEmpstatus",value = "门店列表",required = true) int pmsEmpstatus){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("操作成功");
        responseData.setData(pmsEmpstatus);
        return responseData;
    }



    @GetMapping("/updateStoresOptions")
    @ApiOperation(value = "修改门店列表",notes = "根据提交的信息修改门店列表",httpMethod = "GET",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "修改成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "修改失败")
    })
    public ResponseData updateStoresOptions(@ApiParam(name = "pmsId",value = "门店列表id",required = true) int pmsId){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("修改成功");
        responseData.setData(pmsId);
        return responseData;
    }




    @PostMapping("/queryStoresOptions")
    @ApiOperation(value = "查询门店列表",notes = "根据提交的信息查询门店列表",httpMethod = "POST",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "查询成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "查询失败")
    })
    public ResponseData queryStoresOptions(@ApiParam(name = "pms",value = "门店列表",required = true) StoreSetup storeSetup){
        storeSetup.setStoreStatu(1);
        storeSetup.setTelNumber("12345678911");
        storeSetup.setStoreAdd("成都市新都区");
        storeSetup.getAdministrators().setAdminUsername("张三");
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("查询成功");
        responseData.setData(storeSetup);
        return responseData;
    }
}
